﻿///////////////////////////////////////////////////////////////////////////////
//	Copyright 2013 JASDev International
//
//	Licensed under the Apache License, Version 2.0 (the "License");
//	you may not use this file except in compliance with the License.
//	You may obtain a copy of the License at
//
//		http://www.apache.org/licenses/LICENSE-2.0
//
//	Unless required by applicable law or agreed to in writing, software
//	distributed under the License is distributed on an "AS IS" BASIS,
//	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//	See the License for the specific language governing permissions and
//	limitations under the License.
///////////////////////////////////////////////////////////////////////////////

using System;
using System.Text;

namespace JDI.Pusher.Client
{
	internal static class PusherConst
	{
		public const string PusherOrigin = "jdi-pusher";
		public const string PusherClient = "jdi-pusher";
		public const string LibraryVersion = "1.0.0";
		public const string ProtocolVersion = "5";

		public const bool EncryptionEnabled = false;
		public const bool MaskingEnabled = true;
		public const bool ActivityTimerEnabled = true;
		public const int ActivityTimeout = 120;	// seconds

		public const string EventName_ConnectionEstablished = "pusher:connection_established";
		public const string EventName_SubscriptionSucceeded = "pusher_internal:subscription_succeeded";
		public const string EventName_SubscriptionError = "pusher_internal:subscription_error";
		public const string EventName_UnsubscribeSucceeded = "pusher_internal:unsubscribe_succeeded";
		public const string EventName_MemberAdded = "pusher_internal:member_added";
		public const string EventName_MemberRemoved = "pusher_internal:member_removed";
		public const string EventName_Error = "pusher:error";

		public const string EventName_Subscribe = "pusher:subscribe";
		public const string EventName_UnSubscribe = "pusher:unsubscribe";

		public const string ChannelPrefix_Private = "private-";
		public const string ChannelPrefix_Presence = "presence-";

		public enum EventType
		{
			ConnectionEstablished,	// connection is established
			SubscriptionSucceeded,	// channel subscription succeeds
			SubscriptionError,		// channel subscription fails
			MemberAdded,			// member is added to a presence channel
			MemberRemoved,			// member is removed from a presence channel
			Error,					// an error occured
			Application,			// an application-level event
			Undefined				// unknown type
		}

		public enum ErrorCode
		{
			AppAcceptsSSLOnly = 4000,
			AppDoesNotExist = 4001,
		//	notdefined = 4002,
			AppIsDisabled = 4002,
			AppHasExceededConnQuota = 4004,
			PathNotFound = 4005,
			InvalidVersionFormat = 4006,
			UnsupportedProtocolVersion = 4007,
			NoProtocolVersionSupplied = 4008
		}
	}
}
